package com.example.eventpush.controller;

import com.example.eventpush.publisher.StudentPublisher;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author ZhenWuWang
 */
@Controller
@RequestMapping("/event")
public class PublishEventController
{
    private final StudentPublisher studentPublisher;

    @Autowired
    public PublishEventController(StudentPublisher studentPublisher)
    {
        this.studentPublisher = studentPublisher;
    }

    @GetMapping("/publish")
    @ResponseBody
    public void register() throws Exception
    {
        studentPublisher.publish();
    }
}
